<template>
  <div>
    <h3>key值的作用</h3>
  <ul>
    <li v-for="(item,index) in arr" :key="item">
      <span>{{item}}-- {{index}}</span>
      <input type="text">
    </li>
  </ul>
  <button @click="fn">新来的</button>
  </div>
</template>

<script>
// key: 必须是字符串或者数字  且必须保证唯一性
export default {
  data() {
    return {
      arr: ['老大', '老二', '老三']
    }
  },
  methods: {
    fn() {
      this.arr.splice(1,0 , `新来的${+new Date()}`)
    }
  }
}
</script>

<style>

</style>